Balancing of servers based on sampled utilization ratio and corresponding power consumption

ABSTRACT

A power measurement circuit is disclosed. The power measurement circuit comprises a sampling register, a latch generator, an accumulation unit, a calculation unit and an output register. The sampling register samples an input signal based on a sampling clock to generate a binary digit. The latch generator generates a latch signal based on the sampling clock and a measurement interval. The accumulation unit accumulates the binary digit based on the latch signal to generate a sum value. The calculation unit calculates an ON-phase rate of the input signal according to the sum value and the measurement interval. The output register stores a power consumption value according to the ON-phase rate of the input signal.

BACKGROUND OF THE INVENTION

Field of the Invention

The invention relates to an integrated circuit, and more particularly, to a power measurement circuit, a baseboard management controller (BMC) having the same and load balancing requests based on server power consumption and least-connection scheduling.

Description of the Related Art

Load balancing is the process of distributing processing and communications activity evenly or in some cases unevenly (in scenarios where servers are not of equal computing power) across a computer network so that no single device is overwhelmed or handling 100% of the network or web traffic. Load balancing is especially important for networks where it's difficult to predict the number of requests that will be issued to a server. Busy Web sites typically employ two or more Web servers in a load balancing scheme. If one server starts to get swamped, requests are forwarded to another server with more capacity.

Load balancers generally use different scheduling algorithms to control network traffic. For example, (1) Round-robin: A round-robin algorithm distributes tasks equally to each server in circular order. (2) Fixed weighted: The weight of each server is preassigned and most of the requests are routed to the server with the highest priority. (3) Least-connection: A least-connection algorithm sends requests to servers, based on which server is currently serving the fewest connections. (4) Network Load-based: A load-based algorithm sends requests to servers, based on network traffic flow, such as in terms of bytes or packets.

Each scheduling algorithm has its own set of benefits and suitable scenarios. A service provider can select an optimal algorithm that best suits its purpose to give a smooth, reliable and fast service delivery to its clients. The invention provides a new scheduling algorithm for the load balancers.

On the other hand, a baseboard management controller (BMC) is a specialized service processor that monitors the physical state of a computer, network server or other hardware device using sensors and communicating with a system administrator through an independent connection. The BMC is part of the Intelligent Platform Management Interface (IPMI) and is usually contained in the motherboard or main circuit board of a server to be monitored. However, a conventional BMC does not include any hard-wired circuit dedicated to monitoring power consumption of its server. A system administrator of a corporate network may be present at one location while the servers may be spread around the buildings or even anywhere of the internet. It is very difficult and costly for the system administrator to be physically present at each server side and check power consumption of each server. Accordingly, what is needed is a BMC to address the above-identified problems. The invention addresses such a need.

SUMMARY OF THE INVENTION

In view of the above-mentioned problems, an object of the invention is to provide a power measurement circuit capable of estimating the power consumption of a server.

One embodiment of the invention provides a power measurement circuit. The power measurement circuit comprises a sampling register, a latch generator, an accumulation unit, a calculation unit and an output register. The sampling register samples an input signal based on a sampling clock to generate a binary digit. The latch generator generates a latch signal based on the sampling clock and a measurement interval. The accumulation unit accumulates the binary digit based on the latch signal to generate a sum value. The calculation unit calculates an ON-phase rate of the input signal according to the sum value and the measurement interval. The output register stores a power consumption value according to the ON-phase rate of the input signal.

Another embodiment of the invention provides a server system. The server system comprises a CPU, a P-phase voltage regulator module, a power measurement circuit and a baseboard management controller (BMC). The CPU is coupled to a load balancer via a first network. The P-phase voltage regulator module supplies a regulated voltage to the CPU and generates a first control signal. The power measurement circuit receives a voltage signal according to the first control signal, measures and stores a power consumption value. The BMC coupled to the load balancer via a second network is used to periodically read the power consumption value form the power measurement circuit and send a warning signal to a system administrator through the second network when an abnormal power consumption event is detected. One of the CPU and the BMC sends the power consumption value to the load balancer. The power measurement circuit comprises a sampling register, a latch generator, an accumulation unit, a calculation unit and an output register. The sampling register samples an input signal based on a sampling clock to generate a binary digit. The latch generator generates a latch signal based on the sampling clock and a measurement interval. The accumulation unit accumulates the binary digit based on the latch signal to generate a sum value. The calculation unit calculates an ON-phase rate of the input signal according to the sum value and the measurement interval. The output register stores a power consumption value according to the ON-phase rate of the first control signal.

Another embodiment of the invention provides a system. The system comprises a plurality of client devices, a plurality of servers and a load balancer. The servers periodically sends power consumption values. The load balancer coupled to the client devices through a first network is used to allocate requests from the client devices to the servers based on both the power consumption values and numbers of connections of the servers. Each of the servers comprises a CPU, a P-phase voltage regulator module, a power measurement circuit and a baseboard management controller (BMC). The CPU is coupled to the load balancer via a first network. The P-phase voltage regulator module supplies a regulated voltage to the CPU and generates a first control signal. The power measurement circuit receives a voltage signal according to the first control signal, measures and stores a power consumption value. The BMC coupled to the load balancer via a second network is used to periodically read the power consumption value form the power measurement circuit and send a warning signal to a system administrator through the second network when an abnormal power consumption event is detected. One of the CPU and the BMC sends the power consumption value to the load balancer. The power measurement circuit comprises a sampling register, a latch generator, an accumulation unit, a calculation unit and an output register. The sampling register samples an input signal based on a sampling clock to generate a binary digit. The latch generator generates a latch signal based on the sampling clock and a measurement interval. The accumulation unit accumulates the binary digit based on the latch signal to generate a sum value. The calculation unit calculates an ON-phase rate of the input signal according to the sum value and the measurement interval. The output register stores a power consumption value according to the ON-phase rate of the first control signal.

Another embodiment of the invention provides a method. The method comprises: periodically measuring a power consumption value according to a control signal from a P-phase voltage regulator module by each of a plurality of servers; periodically measuring a power consumption value according to a control signal from a P-phase voltage regulator module by each of a plurality of servers; periodically sending the power consumption value to a load balancer by each of the servers; collecting power consumption values from the plurality of servers by the load balancer, wherein the load balancer is coupled to a client device via a first network and to the servers via a second network; forming a candidate list containing a plurality of candidate servers according to the power consumption values and numbers of connections of the servers by the load balancer; and, allocating a following request from the client device to one candidate server at the top of the candidate list by the load balancer. Here, the step of periodically measuring comprises: sampling a control signal from a P-phase voltage regulator module based on a sampling clock to obtain a binary digit; accumulating the binary digit; repeating the steps of sampling and accumulating until a measurement interval has elapsed to obtain a sum value; calculating an ON-phase rate of the control signal according to the sum value and the measurement interval, wherein P>=1; and, storing the power consumption value according to the ON-phase rate in an output register.

Further scope of the applicability of the present invention will become apparent from the detailed description given hereinafter. However, it should be understood that the detailed description and specific examples, while indicating preferred embodiments of the invention, are given by way of illustration only, since various changes and modifications within the spirit and scope of the invention will become apparent to those skilled in the art from this detailed description.

BRIEF DESCRIPTION OF THE DRAWINGS

The present invention will become more fully understood from the detailed description given hereinbelow and the accompanying drawings which are given by way of illustration only, and thus are not limitative of the present invention, and wherein:

FIG. 1 is a block diagram showing an exemplary system in which a load balancer distributes incoming requests from a plurality of client devices across a plurality of servers based on power consumption of the servers and the least-connection scheduling algorithm

FIGS. 2A-2B are flow charts illustrating different exemplary operations of a load balancer to distribute network communications based on power consumption of the servers and the least-connection scheduling according to the invention.

FIG. 3A is a block diagram showing a server with a level shifter receiving a PWM signal according to an embodiment of the invention.

FIG. 3B is a block diagram showing a server with a level shifter receiving an Ugate signal according to another embodiment of the invention.

FIG. 4 is a block diagram showing the power measurement circuit according to an embodiment of the invention.

FIG. 5 is an example showing a relationship among the shifted signal Ss, the high frequency clock CK, the measurement interval, the latch signal LS and the content of the accumulation register 450.

DETAILED DESCRIPTION OF THE INVENTION

As used herein and in the claims, the term “a,” “an,” “the” and similar terms used in the context of the present invention (especially in the context of the claims) are to be construed to cover both the singular and plural unless otherwise indicated herein or clearly contradicted by the context.

A buck converter is a voltage regulator that provides a stable supply voltage to a CPU in a server. The more the input current into the CPU, the more the power consumption of the CPU. Thus, a feature of the invention is to estimate a power consumption value of a CPU in a server by measuring the input current variations of the CPU. As known in the art, during turned-on phases of phase width modulation (PWM)/phase frequency modulation (PFM) signals, its current source provides currents and its inductor charges; instead, during turned-off phases of the PWM/PFM signals, its inductor provides currents for the CPU in the server. The longer the inductor charges, the more the consumed currents and energy. Accordingly, another feature of the invention is to estimate the power consumption of a CPU in a server by measuring an ON-phase rate of the PWM/PFM/Ugate signal. According to the invention, the ON-phase rate (ONR) of the PWM/PFM/Ugate signal is defined as a number (P) of phases of a PWM/PFM controller multiplied by a ratio between a total interval (SUM) of turned-on phases of the PWM/PFM/Ugate signal and a whole measurement interval (N1), i.e., ONR=(SUM*P)/N1.

Another feature of the invention is to include a power measurement circuit in a BMC. The power measurement circuit measures the power consumption of a CPU in a server and the BMC periodically reads the measured power consumption values from the power measurement circuit. The BMC/CPU provides the measured power consumption values for a load balancer. Following that, the load balancer distributes incoming requests among servers from a server pool based on the measured power consumption values from all the servers and the least-connection scheduling, to thereby balance power consumption among the servers. As soon as any abnormal power consumption event is detected, the BMC issues a warning signal, logs the abnormal power consumption values and informs the system administrator in real time.

FIG. 1 is a block diagram showing an exemplary system in which a load balancer distributes incoming requests from a plurality of client devices across a plurality of servers based on power consumption of the servers and the least-connection scheduling. Referring to FIG. 1, the system 10 includes a plurality of client devices 181˜18M (M>1), a load balancer 160, and a plurality of servers 101˜10N (N>1). The load balancer 160 and the servers 101˜10N are connected to each other by Network-A while the load balancer 160 and the client devices 181˜18M are connected to each other by Network-B. Here, the servers 101˜10N may be logically grouped so as to constitute a server pool 170.

In various embodiments, each of Network-A, Network-B and Network-C may be a local area network (LAN), a wide area network (WAN), a wireless network, an intranet, or the Internet, for example. Example client devices 181˜18M includes, without limitation, personal computers, intermediate network devices, network telephones, network gaming platforms, cellular telephones, network televisions, television set-top boxes. Moreover, each of client devices 181˜18M may be a different kind of network device and each of Network-A, Network-B and Network-C may be a different kind of network. Servers 101˜10N may be any of a few types of servers that provide one or more resources or network services. Although only one load balancer 160 is shown in FIG. 1 for simplicity, any number of load balancers 160 can be present in the network system 10. In one embodiment, each load balancer 160 has its own server pool, whereas in another embodiment two or more load balancers share a common server pool.

Prior to distributing network traffic from client devices 181˜18M among the servers 101˜10N, the load balancer 160 collects power consumption values from the servers 101˜10N of the server pool 170 by two ways. The first way is that the CPU 140 reads the power consumption values from the BMC 110 through IPMI and then the load balancer 160 reads the power consumption values from the CPU 140 through Network-A. The second way is that the load balancer 160 directly reads the power consumption values from the BMC 110 through Network-C.

Referring to FIG. 1, the server 101 includes a BMC 110 with a power measurement circuit 112, a P-phase voltage regulator module 120, a CPU 140 and a level shifter 150. The P-phase voltage regulator module 120 supplies power to the CPU 140 and includes a P-phase voltage regulator 121, a switch 122 and an output circuit 123. The P-phase voltage regulator 121 supplies a control signal VR to the level shifter 150. Here, the control signal VR is one of a PWM signal, a PFM signal and a Ugate signal. The switch 122 is coupled to voltage regulator 121 and the output circuit 123. The output circuit 123 is coupled to the CPU 140. The switch 122 includes P pairs of series connected MOSFETs. The output circuit 123 includes P inductors for storing energy and one capacitor C for supplying a regulated voltage to the CPU 140. The level shifter 150 receives the control signal VR with a first voltage level and converts it into a shifted signal Ss with a second voltage level. The power measurement circuit 112 receives the signal Ss, performs power measurement over the signal Ss, generates a power consumption value R1 and stores the power consumption value R1 in an output register 490 (as shown in FIG. 4). The BMC 110 periodically reads the power consumption value R1 from the output register 490. As soon as any abnormal power consumption event (e.g., a power consumption value is greater than a upper threshold, or less than a lower threshold) is detected, the BMC 110 may issue a warning signal, log the abnormal power consumption value or inform the system administrator 165 in real time.

FIGS. 2A-2B are flow charts illustrating different exemplary operations of a load balancer to distribute network communications based on power consumption the servers and the least-connection scheduling according to the invention. An operational method 200A of the load balancer 160 to distribute network communications based on power consumption of the servers and the least-connection scheduling will be described with reference to FIGS. 1 and 2A.

Step S210: Collect power consumption values R1 (as shown in FIG. 4) from all servers 101˜10N and maintain a connection table including all the servers 101˜10N with their respective numbers of active connections.

Step S220: Form a candidate list including candidate servers with their numbers of connections less than a predefined limit. The load balancer 160 draws up a candidate list in which each candidate server has a number of connections less than a predefined limit according to the connection table. In other words, the load balancer 160 removes any server with a number of connections over the predefined limit from the candidate list.

Step S230: Allocate a following/incoming request to a candidate server with a minimum power consumption according to the candidate list. In one embodiment, in order of power consumption, a candidate server with a minimum power consumption is placed at the top of the candidate list and allocated for a following/incoming request by the load balancer 160.

An operational method 200B of the load balancer 160 to distribute network communications based on power consumption of the servers and the least-connection scheduling will be described with reference to FIGS. 1 and 2B. The steps S210 of the methods 200A and 200B are the same and thus the descriptions are omitted herein.

Step S251: Sort power consumption values R1 from all servers 101˜10N into a plurality of power degrees. According to magnitude, the load balancer 160 sorts all the power consumption values R1 into a plurality of power degrees. For example, the power consumption values are sorted into three power degrees and a third power degree is the minimum power degree.

Step S252: Draw up a candidate list including candidate servers with the minimum power degree. According to the above example of step S251, the load balancer 160 includes the candidate servers with the minimum (third) power degree on the candidate list and removes the candidate servers with first/second power degrees from the candidate list.

Step S253: Allocate a following/incoming request to a candidate server with a fewest number of connections according to the candidate list. In one embodiment, in order of number of connections, a candidate server with a fewest number of connections is placed at the top of the candidate list and allocated for a following/incoming request by the load balancer 160.

FIG. 3A is a block diagram showing a server with a level shifter receiving a PWM signal according to an embodiment of the invention. Referring to FIG. 3A, the server 101A includes a BMC 110 with a power measurement circuit 112, a P-phase voltage regulator 121A, a switch 122 and an output circuit 123, a CPU 140 and a level shifter 150A. In this embodiment, the P-phase voltage regulator 121A includes a two-phase phase width modulation (PWM) controller 301 (i.e., P=2), and two MOSFET drivers 302; besides, it is noted that the PWM controller 301 is separated from the two MOSFET drivers 302. In the embodiment of FIG. 3A, due to the PWM controller 301 having two phases, the PWM controller 301 are connected to two MOSFET drivers 302, each of which is coupled to two series connected MOSFETs UM and LM in the switch 122. Each MOSFET driver 302 receives a PWM signal and supplies two gate control signals Ugate and Lgate to gates of two series connected MOSFETs UM and LM of the switch 122. The CPU 140 is connected to the inductors L1 and L2 and the capacitor C of the output circuit 123. In an alternative embodiment, the PWM controller 301 may have P phases (P>=1), so the PWM controller 301 are connected to P MOSFET drivers 302, each of which is coupled to two series connected MOSFETs UM and LM. In the embodiment of FIG. 3A, the level shifter 150A receives one of two PWM signals PWM1 and PWM2 with a first voltage level of 0V to 5V and converts it into a shifted signal Ss with a second voltage level of 0V to 3.3V. It is noted that the PWM1/PWM2 signals and the shifted signal Ss have same signal patterns, but have different voltage levels.

FIG. 3B is a block diagram showing a server with a level shifter receiving an Ugate signal according to another embodiment of the invention. The BMC 110, the switch 122, the output circuit 123 and the CPU 140 in both servers 101A and 101B are the same. In the embodiment of FIG. 3B, the two-phase PWM controller 301 and the two MOSFET drivers 302 are integrated into one chip 121B, i.e., a two-phase PWM controller 121B with MOSFET drivers. In chip 121B, the PWM controller 301 still has two phases and are connected to two MOSFET drivers 302, each receiving a PWM signal and generating two gate signals Ugate and Lgate. In this embodiment, the level shifter 150B receives one of two gate control signals Ugate1 and Ugate2 with a first voltage level of 0V to 12V and converts it into a shifted signal Ss with a second voltage level of 0V to 3.3V. Please be noted that the two-phase PWM controller 301 of the server 101A can be replaced with a phase frequency modulation (PFM) controller and the two-phase PWM controller 121B with MOSFET drivers of the server 101B can be replaced with a two-phase PFM controller with MOSFET drivers, depending on different circuit needs. It is noted that the gate control signals Ugate1/Ugate2 and the shifted signal Ss have same signal patterns, but have different voltage levels. In the above embodiments, the power measurement circuit 112 is embedded inside the BMC 110. In an alternative embodiment, the power measurement circuit 112 can be separated from the BMC 110 depending on different circuit needs.

FIG. 4 is a block diagram showing the power measurement circuit according to an embodiment of the invention. Referring to FIG. 4, the power measurement circuit 112 includes an accumulation unit 450, a latch generator 420, a sampling register 410, a calculation unit 470, an IIR filter 480 and an output register 490. The accumulation unit 450 includes a multiplexer 451, an adder 452, an accumulation register 453, and a sum register 455. The sampling register 410 samples the shifted signal Ss using a high frequency sampling clock CK to output a binary digit (0/1). In one embodiment, assuming the measurement interval N1=100, which is measured in terms of a number of periods of the sampling clock OK; a counter output (cnt) is increased by 1 each time the counter (not shown) is triggered by the high frequency sampling clock CK in the latch generator 420; the latch generator 420 uses the following program codes to generate a latch signal LS:

 cnt = 0; N1 = 100; LS=1; for i=0:(N1−1) begin  cnt = cnt + 1;  if(cnt ==(N1)){  LS=1;  cnt=0; }  Else {  LS=0  }  end

In the meantime, according to the voltage level of the latch signal LS, the multiplexer 451 selects a first input terminal and a second input terminal for output. In one embodiment, when the latch signal LS has a low logic level, the multiplexer 451 selects the second input terminal (coupled to the output of the accumulation register 450) for output; when the latch signal LS has a high logic level, the multiplexer 451 selects the first input terminal (applied with a predefined value of 0) for output. The adder 452 adds the binary digit from the sampling register 410 and the output of the multiplexer 451 to output an added value AD and temporarily store it in the accumulation register 453. As soon as the measurement interval ends (i.e., cnt==N1), the sum register 455 latches the data from the accumulation register 453 at the rising/falling edge of the latch signal LS. Next, the calculation unit 470 reads a value SUM from the sum register 455 and calculates an ON-phase rate ONR of the control signal VR according to the measurement interval N1 and the number P of phases of the PWM controller 301 using the following equation: ONR=(SUM*P)/N1. In one embodiment, the IIR filter 480 uses the following infinite impulse response (IIR) equation to obtain an averaged ON-phase rate R1, where two parameters w1, w2 are preset values: R1=(ONR*w1+R1*w2)/(w1+w2). As a result, the output register 490 stores the averaged ON-phase rate R1 and is periodically read out as a power consumption value by the BMC 110. Please be noted that depending on different circuit needs, the calculation unit 470 can directly store the ON-phase rate ONR of the control signal VR in the output register 490, eliminating the need of including the IIR filter 480. Thus, the IIR filter 480 is optional and represented in dotted lines. In an alternative embodiment, the IIR filter 480 can be replaced with a lowpass filter.

FIG. 5 is an example showing a relationship among the shifted signal Ss, the high frequency clock CK, the measurement interval, the latch signal LS and the content of the accumulation register 453. The operations of the latch generator 420, the multiplexer 451, the sampling register 410, the adder 452, and the accumulation register 453 are described with reference to FIGS. 4 and 5. After the measurement interval begins (the counter output (cnt) starts to increase from 0), the latch signal LS has a low logic level and the multiplexer 451 selects the second input terminal for output. When a turned-on phase of the shifted signal Ss is sampled using the high frequency clock CK, the sampling register 410 outputs a binary digit 1; when a turned-off phase of the shifted signal Ss is sampled using the high frequency clock CK, the sampling register 410 outputs a binary digit 0. The adder 452 adds the binary digit from the sampling register 410 and the output of the accumulation register 453 to output an added value AD and temporarily store it in the accumulation register 453. In this manner, the accumulation register 453 continues accumulating turned-on phases of the shifted signal Ss until the measurement interval ends (e.g., cnt==N1). In this example, N1=100 and P=2; besides, after the measurement interval ends (i.e., cnt==N1), a SUM value of 28 is read from the sum register 460. Thus, the calculation unit 470 generates an ON-phase rate ONR=28*2/100=56/100.

As known in the art, upon decoding, a PWM decoder/receiver needs to align the start and the end of a PWM pulse with a measurement interval and a sampling clock, and measure its turned-on width and turned-off width to generate a decoded digit. Upon decoding, a PFM decoder/receiver needs to find the start and the end of a PFM pulse, and measure its frequency to generate a decoded digit. In addition, both of the PWM and PFM signals have to be decoded on a pulse-by-pulse basis. In contrast, since only turned-on phases of the shifted signal Ss are accumulated during the measurement interval, there is no need for any edge of the shifted signal Ss to be aligned with the measurement interval and the high frequency clock CK, and there is no need for the shifted signal Ss to be measured on a pulse-by-pulse basis in the invention. In other words, the start and the width of the measurement interval are arbitrary in the invention.

In sum, the invention has the following advantages. First, it is easy to measure the power consumption value R1 (or the ON-phase rate ONR) in comparison with the PWM/PFM decoder/receiver. Second, by constantly measuring the power consumption values R1 using the power measurement circuit and by periodically reading the power consumption values R1 using the BMC, any abnormal power consumption event can be detected in real time and a system administrator can be immediately informed. Third, by periodically collecting the power consumption values R1 from all the servers, the load balancer can distribute network communications (or requests) from client devices based on power consumption of the servers and the least-connection scheduling, to thereby improve efficiency and balance power consumption among the servers.

While certain exemplary embodiments have been described and shown in the accompanying drawings, it is to be understood that such embodiments are merely illustrative of and not restrictive on the broad invention, and that this invention should not be limited to the specific construction and arrangement shown and described, since various other modifications may occur to those ordinarily skilled in the art. 

What is claimed is:
 1. A circuit, comprising: a CPU; a P-phase voltage regulator circuit connected to the CPU and comprising one of a PWM controller and a PFM controller that generates P modulation signals; and a power measurement circuit coupled to the P-phase voltage regulator circuit and comprising: a sampling register for sampling an input signal based on a sampling clock to generate a binary digit; a latch generator for generating a latch signal with one of two states based on the sampling clock and a measurement interval; an accumulation circuit for accumulating the binary digit based on the latch signal to generate a sum value; a calculation circuit for calculating an ON-phase rate of the input signal according to the sum value and the measurement interval; and an output register for storing a power consumption value of the CPU according to the ON-phase rate of the input signal; wherein the power consumption value of the CPU is obtained based on the ON-phase rate; wherein the power consumption value is provided to a load balancer that allocates requests based on the power consumption value; wherein P>=1 and the input signal is one of the P modulation signals.
 2. The circuit according to claim 1, wherein the accumulation circuit comprises: an accumulation register; a multiplexer for selecting one of a predefined value and an output value of the accumulation register to output a selected value in response to a state of the latch signal; an adder for adding the binary digit and the selected value to store an added value in the accumulation register; and a sum register for latching the output of the accumulation register at a specified edge of the latch signal to store the sum value.
 3. The circuit according to claim 1, further comprising: a filter coupled between the calculation circuit and the output register for averaging the output of the output register and the ON-phase rate of the input signal to store an averaged value in the output register; and wherein the filter is one of an IIR filter and a lowpass filter.
 4. The circuit according to claim 1, wherein the P phase voltage regulator circuit further comprises P MOSFET drivers that are connected to the one of the PWM controller and the PFM controller and that respectively receive the P modulation signals and generate P upper gate signals and P lower gate signals, and wherein the input signal is one of the P modulation signals and the P upper gate signals.
 5. The circuit according to claim 1, wherein the ON-phase rate (ONR) of the input signal is given by ONR=(SUM*P)/N1; wherein SUM denotes the sum value and N1 denotes the measurement interval measured in terms of a number of periods of the sampling clock.
 6. A server system, comprising: a CPU coupled to a load balancer via a first network; a P-phase voltage regulator circuit for supplying a regulated voltage to the CPU and for generating a first control signal; a power measurement circuit coupled to the P-phase voltage regulator circuit for receiving a voltage signal according to the first control signal and for measuring and storing a power consumption value of the CPU; and a baseboard management controller (BMC) coupled to the load balancer via a second network for periodically reading the power consumption value form the power management circuit and sending a warning signal to a system administrator through the second network when an abnormal power consumption event is detected, wherein one or both of the CPU and the BMC sends the power consumption value to the load balancer; wherein the power measurement circuit comprises: a sampling register for sampling the voltage signal based on a sampling clock to generate a binary digit; a latch generator for generating a latch signal with one of two states based on the sampling clock and a measurement interval; an accumulation circuit for accumulating the binary digit based on the latch signal to generate a sum value; a calculation circuit for calculating an ON-phase rate of the first control signal according to the P value, the sum value and the measurement interval, wherein P>=1; and an output register for storing the power consumption value according to the ON-phase rate of the first control signal; wherein the power consumption value of the CPU is obtained based on the ON-phase rate; wherein the P-phase voltage regulator circuit comprises one of a PWM controller and a PFM controller that generates P modulation signals; wherein the first control signal is one of the P modulation signals; and wherein the first network is different form the second network.
 7. The system according to claim 6, wherein the P-phase voltage regulator circuit comprises: a switch; a P-phase voltage regulator comprising the one of the PWM controller and the PFM controller and sending 2*P second control signals to the switch; and an output circuit coupled to the switch and comprising an inductor for storing energy and a capacitor for supplying the regulated voltage to the CPU.
 8. The system according to claim 7, wherein the switch comprises P pairs of series connected MOSFETs, wherein the 2*P second control signal comprises P upper gate control signals and P lower gate control signals for respectively controlling gates of the P pairs of series connected MOSFETs, and wherein the first control signal is one of the P modulation signals and the P upper gate control signals.
 9. The system according to claim 7, wherein the P-phase voltage regulator comprises: the one of the PWM controller and the PFM controller that generates the P modulation signals; and P MOSFET drivers for respectively receiving the P modulation signals and generating the 2*P second control signals.
 10. The system according to claim 6, wherein the ON-phase rate (ONR) of the first control signal is given by ONR=(SUM*P)/N1; wherein SUM denotes the sum value and N1 denotes the measurement interval measured in terms of a number of periods of the sampling clock.
 11. The system according to claim 6, wherein the power measurement circuit further comprises: a filter coupled between the calculation circuit and the output register for averaging the output of the output register and the ON-phase rate of the first control signal to store an averaged value in the output register; and wherein the filter is one of an IIR filter and a lowpass filter.
 12. The system according to claim 6, wherein the BMC periodically sends the power consumption value to the load balancer through the second network.
 13. The system according to claim 6, further comprising: an intelligent platform management interface (IPMI) coupled between the BMC and the CPU; wherein the CPU periodically reads the power consumption value from the BMC through the IPMI and sends the power consumption value to the load balancer through the first network.
 14. The system according to claim 6, wherein the power measurement circuit is embedded inside the BMC.
 15. The system according to claim 6, wherein the power measurement circuit is separated from the BMC.
 16. A system comprising a plurality of client devices; a plurality of servers for periodically sending power consumption values of their CPUs; and a load balancer coupled to the client devices through a first network for allocating requests from the client devices to the servers based on both the power consumption values and numbers of connections of the servers; wherein each of the servers comprises: a CPU coupled to the load balancer via a second network; a P-phase voltage regulator circuit for supplying a regulated voltage to the CPU and for generating a first control signal; a power measurement circuit coupled to the P-phase voltage regulator circuit for receiving a voltage signal according to the first control signal and for measuring and storing one power consumption value of the CPU; and a baseboard management controller (BMC) coupled to the load balancer via a third network for periodically reading the power consumption value form the power measurement circuit and sending a warning signal to a system administrator through the third network when an abnormal power consumption event is detected, wherein one or both of the CPU and the BMC sends the power consumption value to the load balancer; wherein the power measurement circuit comprises: a sampling register for sampling the voltage signal based on a sampling clock to generate a binary digit; a latch generator for generating a latch signal with one of two states based on the sampling clock and a measurement interval; an accumulation circuit for accumulating the binary digit based on the latch signal to generate a sum value; a calculation circuit for calculating an ON-phase rate of the first control signal according to a sum value and the measurement interval, wherein P>=1; and an output register coupled to the calculation circuit for storing the power consumption value according to the ON-phase rate of the first control signal; wherein the power consumption value of the CPU is obtained based on the ON-phase rate; wherein the P-phase voltage regulator circuit comprises one of a PWM controller and a PFM controller that generates P modulation signals; wherein the first control signal is one of the P modulation signals; and wherein the third network is different form the second network.
 17. The system according to claim 16, wherein the P-phase voltage regulator circuit further comprises P MOSFET drivers that respectively receive the P modulation signals and generate P upper gate control signals and P lower gate control signals, wherein the first control signal is one of the P modulation signals and the P upper gate control signals.
 18. The system according to claim 16, wherein the ON-phase rate (ONR) of the first control signal is given by ONR=(SUM*P)/N1; wherein SUM denotes the sum value and N1 denotes the measurement interval measured in terms of a number of periods of the sampling clock.
 19. The system according to claim 16, wherein the BMC periodically sends the power consumption value to the load balancer through the third network.
 20. The system according to claim 16, wherein each of the servers further comprises: an intelligent platform management interface (IPMI) coupled between the BMC and the CPU; wherein the CPU periodically reads the power consumption value from the BMC through the IPMI and sends the power consumption value to the load balancer through the second network.
 21. The system according to claim 16, wherein the load balancer is configured to form a candidate list containing a plurality of candidate servers with their numbers of connections less than a limit, and to allocate a following request to a candidate server with a minimum power consumption value.
 22. The system according to claim 16, wherein the load balancer is configured to sort each of the power consumption values into multiple power degrees, to form a candidate list containing a plurality of candidate servers with the minimum power degree, and to allocate a following request to a candidate server with a fewest number of connections.
 23. A method comprising: periodically measuring a power consumption value of a CPU according to a control signal from a P-phase voltage regulator circuit by each of a plurality of servers; periodically sending the power consumption value to a load balancer by each of the servers; collecting power consumption values from the plurality of servers by the load balancer, wherein the load balancer is coupled to a client device via a first network and to the servers via a second network; forming a candidate list containing a plurality of candidate servers according to the power consumption values and numbers of connections of the servers by the load balancer; and allocating a following request from the client device to one candidate server at the top of the candidate list by the load balancer; wherein the step of periodically measuring comprises: sampling the control signal from the P-phase voltage regulator circuit based on a sampling clock to obtain a binary digit; accumulating the binary digit; repeating the steps of sampling and accumulating until a measurement interval has elapsed to obtain a sum value; calculating an ON-phase rate of the control signal according to the sum value and the measurement interval, wherein P>=1; and storing the power consumption value according to the ON-phase rate in an output register; wherein the power consumption value of the CPU is obtained based on the ON-phase rate; wherein the P-phase voltage regulator circuit is connected to the CPU and comprises one of a PWM controller and a PFM controller that generates P modulation signals; and wherein the control signal is one of the P modulation signals.
 24. The method according to claim 23, wherein the step of storing further comprises: averaging the content of the output register and the ON-phase rate to obtain an average value; and storing the averaged value in the output register.
 25. The method according to claim 23, further comprising: periodically reading the power consumption value from the output register by a BMC at each of the servers after the step of periodically measuring; and sending a warning signal to a system administrator through a third network by the BMC at each of the servers when an abnormal power consumption event is detected.
 26. The method according to claim 23, wherein the step of periodically sending comprises: periodically reading the power consumption value from the output register by a BMC at each of the servers; periodically reading the power consumption value from the BMC through an IPMI by the CPU at each of the servers, wherein the IPMI is coupled between the CPU and the BMC at each of the servers; and periodically sending the power consumption value to the load balancer through the second network by the CPU at each of the servers.
 27. The method according to claim 23, wherein the step of periodically sending comprises: periodically reading the power consumption value from the output register by a BMC at each of the servers; and periodically sending the power consumption value to the load balancer through a third network by the BMC at each of the servers.
 28. The method according to claim 23, wherein the step of forming the candidate list comprises: forming the candidate list containing the candidate servers with their numbers of connections less than a limit; and placing the one candidate server with a minimum power consumption value at the top of the candidate list.
 29. The method according to claim 23, wherein the step of forming the candidate list comprises: sorting each of the power consumption values into multiple power degrees; forming the candidate list containing the candidate servers with a minimum power degree; and placing the one candidate server with a fewest number of connections at the top of the candidate list.
 30. The method according to claim 23, wherein the P-phase voltage regulator circuit further comprises P MOSFET drivers that respectively receive the P modulation signals and generate P upper gate control signals and P lower gate control signals, wherein the control signal is one of the P modulation signals and the P upper gate control signals.
 31. The method according to claim 23, wherein the ON-phase rate (ONR) of the control signal is given by ONR=(SUM*P)/N1; wherein SUM denotes the sum value and N1 denotes the measurement interval measured in terms of a number of periods of the sampling clock. 